<?php

/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/8/18 16:41
 * Desc: 景点请求参数验证
 */
class Request_Api_V2_Spot extends Request_Api_V2_Base
{
    public function __construct($request_param)
    {
        parent::__construct($request_param);
    }

    public function query()
    {
        $this->rules = [
            ['page', ['not_empty', 'digit', $this->rule_min(1)]],
            ['pagesize', ['not_empty', 'digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function get_detail()
    {
        $this->rules = [
            ['id', ['not_empty', 'digit']],
        ];

        return $this;
    }

    public function calendar_price()
    {
        $this->rules = [
            ['suit_id', ['not_empty', 'digit']],
            ['is_seckill', ['digit']],
            ['together_id', ['digit']],
        ];

        return $this;
    }

    public function suit_info()
    {
        $this->rules = [
            ['suit_id', ['not_empty', 'digit']]
        ];

        return $this;
    }

    public function add_order()
    {
        //自定义规则
        $this->validation->rule('mid',array('Rule_Member','need_member'));

        $this->rules = [
            ['product_id', ['not_empty', 'digit']],
            ['book_list', ['not_empty']],
//            ['use_date', ['not_empty',  $this->rule_date_format('Y-m-d')]],
//            ['ding_num', ['not_empty', 'digit', $this->rule_min(1)]],
            ['source', ['not_empty']],
//            ['link_info', ['not_empty']],
            ['together_id', ['digit']],
            ['join_id', ['digit']],
            ['seckill_id', ['digit']],
        ];

        return $this;
    }

    public function book_calendar()
    {
        $this->rules = [
            ['suit_id', ['not_empty', 'digit']],
            ['is_seckill', ['digit']],
            ['together_id', ['digit']],
        ];

        return $this;
    }

    public function book_suit()
    {
        $this->rules = [
            ['spot_id', ['not_empty', 'digit']],
            ['date', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['suit_id', ['digit']],
        ];

        return $this;
    }

    public function book_sku()
    {
        $this->rules = [
            ['date', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['suit_id', ['digit']],
        ];

        return $this;
    }
}